var url = "http://www.baidu.com?id=22&name=zyk&gender=男"
String.prototype.query = function(url){
    let obj = {}
    let str = url.split('?')
    let str2 = str[1].split('&')
    for(i=0;i<str2.length;i++){
        let str3 = str2[i].split('=')
        obj[str3[0]] = str3[1]
    }
    console.log(obj)
}
String.prototype.query(url)